package com.maizhi.junit;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.maizhi.model.Menu;
import com.maizhi.service.BaseServiceI;
import com.maizhi.util.SpringUtil;



@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring-hibernate.xml"})
public class dbTest {
	
	private SessionFactory sessionFactory;
	BaseServiceI<Menu> menuService;
 
	public BaseServiceI<Menu> getMenuService() {
		return menuService;
	}

	@Autowired
	public void setMenuService(BaseServiceI<Menu> menuService) {
		this.menuService = menuService;
	}

	@Before
	public void dbInit(){
		//SessionFactory sessionFactory = (SessionFactory) SpringUtil.getBean("sessionFactory");
	}
	
	@Test
	public void dbInitTest(){
		List list = menuService.find("FROM TSysMenu");	
		System.out.println(list);
	}
}













